Skip to content

Repair C++ logit validation - #4

Open
kenjorissen wants to merge 1 commit into
iafiscal1212:mainfrom
kenjorissen:fix/logit-validation-tools
Open

Repair C++ logit validation#4
kenjorissen wants to merge 1 commit into
iafiscal1212:mainfrom
kenjorissen:fix/logit-validation-tools

Conversation

@kenjorissen

Copy link
Copy Markdown

Summary

  • make validate-logits.py invoke the existing dump-logits executable and read its binary output
  • validate the serialized dimensions and payload before reshaping the logits
  • add the missing <algorithm> include required by std::partial_sort
  • cover the wrapper protocol with a deterministic regression test and exercise the real executable from the synthetic-GGUF end-to-end test

Root cause

run_cpp() documented a C++ comparison but returned None without invoking dump-logits. The executable also depended on a transitive <algorithm> include, so a clean GCC 15 tools build failed at std::partial_sort.

This change makes the existing validation path operational and checks malformed or inconsistent output before comparison.

Validation

  • ctest --test-dir build --output-on-failure (2/2 passed)
  • python3 -m py_compile tools/validate-logits.py tests/test-validate-logits.py tests/test-e2e.py
  • production control with Dream-v0-Instruct-7B Q4_K_M: the repaired path returned finite float32 logits with shape [4, 152064]
  • git diff --check upstream/main...HEAD

Follow-up context

I have separate fixes in preparation for Dream candidate ranking, Dream shifted-cache behavior, and tokenizer-specific mask removal. Their full tools builds depend on the missing-header repair here, and this working logit comparison provides a useful correctness check; they are intentionally excluded from this focused PR and will be rebased after it lands.

A larger, separate series adds GGML device discovery and CPU/GPU offload support, including cached and autoregressive paths plus backend-divergence diagnostics for Vulkan and Metal. That work will remain separate and build on the corrected CPU/validation baseline rather than expanding this PR.

AI assistance disclosure

I used OpenAI Codex to help investigate the bug, implement the change, and develop the tests. I reviewed the final diff and test results and take responsibility for the contribution.

validate-logits.py documented a C++ comparison but returned None without invoking the existing dump-logits binary. The binary also used std::partial_sort without including algorithm, which fails a clean GCC 15 build.

Read dump-logits shape and float data, validate the serialized dimensions, and compare the result as documented. Cover the wrapper protocol with a deterministic stand-in executable, then exercise the real dump-logits binary and synthetic GGUF in the existing end-to-end test.

Assisted-by: OpenAI Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant